package org.cangku.controller;

import org.cangku.dao.XiaoShouDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

@Controller
@RequestMapping("/xiaoshou")
public class XiaoShouController {

    @Autowired
    private XiaoShouDao xiaoShouDao;

    @RequestMapping("/query")
    @ResponseBody
    public Map<String,Object> query(String danhao,int offset,int limit){
        Map<String,Object> map = new HashMap<String,Object>();

        map.put("rows",xiaoShouDao.query(danhao,offset,limit));
        map.put("total",xiaoShouDao.getQueryCount(danhao));

        return map;
    }
}
